from flask_login import UserMixin


class User(UserMixin):
    def __init__(self, name=None, password=None, cn=None):
        self._name = name
        self._password = password
        self._id = name+','+cn
        self._cn = cn

    def get_name(self):
        return self._name

    def get_cn(self):
        return self._cn

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        try:
            return unicode(self._id)  # python 2
        except NameError:
            return str(self._id)  # python 3
